
import request from '@/utils/request'
//农业平台公共接口
export default {
    /***
     * 农业平台品种类型接口
     */
    //品种类型
    plantType() {
        const url = `/v3/category/plantType/queryTree`
        return request({
            url: url,
            method: 'get'
        })
    },
    //添加品种类别
    addApplyPlantType(data = {}) {
        const url = `/v3/category/applyPlantType/add`
        return request({
            url: url,
            method: 'post',
            data: {
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
    //编辑品种类别
    editApplyPlantType(data = {}) {
        const url = `/v3/category/applyPlantType/edit`
        return request({
            url: url,
            method: 'post',
            data: {
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
    //查询审核品种类别
    applyPlantType(data = {}) {
        const url = `/v3/category/applyPlantType/queryByCondition`
        return request({
            url: url,
            method: 'post',
            data: {
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
    /***
     * 农业平台品种接口
     */
    //品种
    plantVariety(data = {}) {
        const url = `/v3/category/plantVariety/queryPageByCondition`
        return request({
            url: url,
            method: 'post',
            data: {
                ...data,
                entity: {
                    ...data.entity || {},
                    farming: 'FISH'
                }
            }
        })
    },
    plantVarietyNo(data = {}) {
        const url = `/v3/category/plantVariety/queryByCondition`
        return request({
            url: url,
            method: 'post',
            data: {
                farming: 'FISH',
                ...data
            }
        })
    },
    //添加品种
    addPlantVariety(data = {}) {
        const url = `/v3/category/applyPlantVariety/add`
        return request({
            url: url,
            method: 'post',
            data: {
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
    //编辑品种
    editPlantVariety(data = {}) {
        const url = `/v3/category/applyPlantVariety/edit`
        return request({
            url: url,
            method: 'post',
            data: {
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
    seeimgmets(no) {
        const url = `/v3/templateTenant/plantVarietyPicture/queryByNo?no=${no}&organizationNo=${sessionStorage.organizationNo}`
        return request({
            url: url,
            method: 'get'
        })
    },
    //查询审核品种
    applyPlantVariety(data = {}) {
        const url = `/v3/category/applyPlantVariety/queryByCondition`
        return request({
            url: url,
            method: 'post',
            data: {
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },

    //物料
    material(params = {}) {
        const url = `/v3/template/material/queryPageByCondition`
        return request({
            url: url,
            method: 'post',
            data: {
                page: params.page,
                size: params.size,
                auditFlag: 1,
                entity: {
                    ...params.entity || {},
                    organizationNo: sessionStorage.organizationNo,
                    farming: sessionStorage.farming
                }
            }
        })
    },
    //添加物料
    addMaterial(data = {}) {
        const url = `/v3/template/applyMaterial/add`
        return request({
            url: url,
            method: 'post',
            data: {
                applyStatus: 1,
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
    //编辑品种
    editMaterial(data = {}) {
        const url = `/v3/template/applyMaterial/edit`
        return request({
            url: url,
            method: 'post',
            data: {
                applyStatus: 1,
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
    //查询审核物料
    applyMaterial(data = {}) {
        const url = `/v3/template/applyMaterial/queryByCondition`
        return request({
            url: url,
            method: 'post',
            data: {
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },


    //物料类型
    materialType() {
        const url = `/v3/template/materialType/queryTreeByCondition`
        return request({
            url: url,
            method: 'post',
            data: {
                isPlantSystemFlag: true
            }
        })
    },
    //查询物料类型
    applyMaterialType(data = {}) {
        const url = `/v3/template/applyMaterialType/queryByCondition`
        return request({
            url: url,
            method: 'post',
            data: {
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },

    //添加物料类型
    addApplyMaterialType(data = {}) {
        const url = `/v3/template/applyMaterialType/add`
        return request({
            url: url,
            method: 'post',
            data: {
                applyStatus: 1,
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
    //编辑物料类型
    editApplyMaterialType(data = {}) {
        const url = `/v3/template/applyMaterialType/edit`
        return request({
            url: url,
            method: 'post',
            data: {
                applyStatus: 1,
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
    /**
     * 
     * 农业平台单位
     */
    // 单位
    unit(data = {}) {
        const url = `/v3/template/unit/queryPageByCondition`
        return request({
            url: url,
            method: 'post',
            data: {
                ...data
            }
        })
    },
    //所有单位
    allUnit(data = {}) {
        const url = `/v3/template/unit/queryByCondition`
        return request({
            url: url,
            method: 'post',
            data: {
                auditFlag: 1,
                ...data
            }
        })
    },
    //条件查询单位类型
    queryUnitType(data = {}) {
        const url = `/v3/template/unitType/queryByCondition`
        return request({
            url: url,
            method: 'post',
            data: {
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
    //审核单位
    applyUnit(data = {}) {
        const url = `/v3/template/applyUnit/queryByCondition`
        return request({
            url: url,
            method: 'post',
            data: {
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
    //添加单位
    addApplyUnit(data = {}) {
        const url = `/v3/template/applyUnit/add`
        return request({
            url: url,
            method: 'post',
            data: {
                applyStatus: 1,
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
    //编辑单位
    editApplyUnit(data = {}) {
        const url = `/v3/template/applyUnit/edit`
        return request({
            url: url,
            method: 'post',
            data: {
                applyStatus: 1,
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },

    /***
     *农业平台单位类型
     */

    // 分页单位类型
    unitType(data = {}) {
        const url = `/v3/template/unitType/queryPageByCondition`
        return request({
            url: url,
            method: 'post',
            data
        })
    },
    //审核单位类型
    applyUnitType(data = {}) {
        const url = `/v3/template/applyUnitType/queryByCondition`
        return request({
            url: url,
            method: 'post',
            data: {
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
    //添加单位类型
    addApplyUnitType(data = {}) {
        const url = `/v3/template/applyUnitType/add`
        return request({
            url: url,
            method: 'post',
            data: {
                applyStatus: 1,
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
    //编辑单位类型
    editApplyUnitType(data = {}) {
        const url = `/v3/template/applyUnitType/edit`
        return request({
            url: url,
            method: 'post',
            data: {
                applyStatus: 1,
                organizationNo: sessionStorage.organizationNo,
                ...data
            }
        })
    },
}
